﻿@model HanGu.Entity.MemberInfo
@{
    ViewBag.Title = "资料修改——我的汉古";
    Layout = "~/Views/Shared/Main.cshtml";
    TempData["sidecalss"] = "EveryDayWisdom";

    TempData["TitlePic"] = Model.PicPath.Replace("_B.", "_S.");
    TempData["ContorlID"] = "Introduction";
    TempData["Remark"] = Model.Introduction;
    TempData["GropName"] = Model.GUID;
    var SexList = ViewData["SexList"] as SelectList;
    var IsMarryList = ViewData["IsMarry"] as SelectList;
    var ProviceList = ViewData["Provice"] as SelectList;
    var CityList = ViewData["City"] as SelectList;
    var NativePlaceList = ViewData["NativePlace"] as SelectList;
    var JobList = ViewData["Job"] as SelectList;
    var TradeList = ViewData["Trade"] as SelectList;
    var InterestList = ViewData["Interest"] as SelectList;
    List<string> InterestArry = new List<string>();
    if (Model.Interest != null)
    { InterestArry.AddRange(Model.Interest.Split(',')); }
    var MemberGrade = ViewData["MemberGrade"] as SelectList;
    var Degree = ViewData["Degree"] as SelectList;


}
@section Header
{
    <style>
        .contentLeft
        {
            width: 100%;
        }
        #partContent
        {
            width: 100%;
        }
        .movieContain
        {
            width: 100%;
            margin-top: 5px;
        }
    </style>
    <script>
        function SelectJobOther(value, obj) {
            if (value.indexOf("9999") > 0)
            { $("#EditInfoForm #" + obj).show(); }
            else
            { $("#EditInfoForm #" + obj).hide(); }
        }
        $(document).ready(function () {
            SelectJobOther("", "JobOther");
            SelectJobOther("", "TradeOther");
            //$("#EditInfoForm #Degree").val("@Model.Degree");
            //$("#EditInfoForm #Grade").val("@Model.Grade");
            $("#EditInfoForm #Sex").val("@Model.Sex");
            $("#EditInfoForm #IsMarry").val("@Model.IsMarry");
            $("#EditInfoForm #Provice").val("@Model.Provice");
            $("#EditInfoForm #City").val("@Model.City");
            $("#EditInfoForm #NativePlace").val("@Model.NativePlace");
            $("#EditInfoForm #Job").val("@Model.Job");
            $("#EditInfoForm #Trade").val("@Model.Trade");

            var message = '@MvcHtmlString.Create(TempData["message"] as string)';
            if (message != null && message.length > 0) {
                alert(message);
            }
        });   
    </script>
}
@section Banner
{
    @Html.Partial("Banner")
}
@section Content{
    <div class="contentLeft">
        <form method="post" id="EditInfoForm" action="/vip/editinfo">
        <table cellpadding="0" cellspacing="0" id="partContent" style="height: 100%;">
            <tr>
                <td>
                    <div class="ContentTitle">
                        <div class="ContentTitleLeft">
                            <img src="/Content/images/vipmyhanguTitle.gif" width="145" height="26" alt=""></div>
                        <div class="ContentTitleRight">
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td class="content">
                    <div class="contentLeft" style="height: 550px; width: 150px; background-color: #ccc">
                        @Html.Partial("vipLeftMenu")
                    </div>
                    <div class="contentLeft MyInfo" style="height: 100%; width: 500px; margin-left: 20px;">
                        <div class="rightDiv">
                            @Html.HiddenFor(c => c.ID)
                            @Html.HiddenFor(c => c.PicPath)
                            @Html.HiddenFor(c => c.GUID)
                            @Html.HiddenFor(c => c.Degree)
                            @Html.HiddenFor(c => c.Grade)
                            <p>
                                <label>
                                    真实姓名：</label>
                                @Html.TextBoxFor(model => model.RealName, new { @class = "required" })
                                @Html.ValidationMessageFor(model => model.RealName)
                            </p>
                            <p>
                                <label>
                                    学位：</label>
                                @Degree.SingleOrDefault(c => c.Value == Model.Degree).Text
                            </p>
                            <p>
                                <label>
                                    级别：</label>
                                @MemberGrade.SingleOrDefault(c => c.Value == Model.Grade).Text
                            </p>
                            <p>
                                <label>
                                    性别：</label>
                                @Html.DropDownListFor(model => model.Sex, SexList, new { @class = "" })
                                @Html.ValidationMessageFor(model => model.Sex)
                            </p>
                            <p>
                                <label>
                                    婚姻状况：</label>
                                @Html.DropDownListFor(model => model.IsMarry, IsMarryList, new { @class = "" })
                                @Html.ValidationMessageFor(model => model.IsMarry)
                            </p>
                            <p>
                                <label>
                                    手机：</label>
                                @Html.TextBoxFor(model => model.Tel, new { @class = "required Tel" })
                                @Html.ValidationMessageFor(model => model.Tel)
                            </p>
                            <p>
                                <label>
                                    邮箱：</label>
                                @Html.TextBoxFor(model => model.Email, new { @class = "required email" })
                                @Html.ValidationMessageFor(model => model.Email)
                            </p>
                            <p>
                                <label>
                                    证件号码：</label>
                                @Html.TextBoxFor(model => model.CredentialNum, new { @class = "required" })
                                @Html.ValidationMessageFor(model => model.CredentialNum)
                            </p>
                            <p>
                                <label>
                                    所在城市：</label>
                                @Html.DropDownListFor(model => model.Provice, ProviceList, new { @class = "", @ref = "City", @refUrl = "admin/Area/GetCitys/{value}" })
                                &nbsp;
                                @Html.DropDownListFor(model => model.City, CityList, new { @class = "" })
                            </p>
                            <p>
                                <label>
                                    通讯地址：</label>
                                @Html.TextBoxFor(model => model.Address, new { @class = "" })
                                @Html.ValidationMessageFor(model => model.Address)
                            </p>
                            <p>
                                <label>
                                    邮编：</label>
                                @Html.TextBoxFor(model => model.Zip, new { @class = "" })
                                @Html.ValidationMessageFor(model => model.Zip)
                            </p>
                            <p>
                                <label>
                                    籍贯：</label>
                                @Html.DropDownListFor(model => model.NativePlace, NativePlaceList, new { @class = "" })
                                @Html.ValidationMessageFor(model => model.NativePlace)
                            </p>
                            <p style="width: 500px">
                                <label>
                                    职业：</label>
                                @Html.DropDownListFor(model => model.Job, JobList, new { @class = "", @onchange = "SelectJobOther(this.value,'JobOther')" })
                                @Html.TextBoxFor(model => model.JobOther, new { @class = "" })
                                @Html.ValidationMessageFor(model => model.NativePlace)
                            </p>
                            <p>
                                <label>
                                    工作单位：</label>
                                @Html.TextBoxFor(model => model.WorkAddress, new { @class = "" })
                                @Html.ValidationMessageFor(model => model.WorkAddress)
                            </p>
                            <p style="width: 500px">
                                <label>
                                    所属行业：</label>
                                @Html.DropDownListFor(model => model.Trade, TradeList, new { @class = "", @onchange = "SelectJobOther(this.value,'TradeOther')" })
                                @Html.TextBoxFor(model => model.TradeOther, new { @class = "" })
                                @Html.ValidationMessageFor(model => model.Trade)
                            </p>
                            <p>
                                <label>
                                    职位：</label>
                                @Html.TextBoxFor(model => model.Position, new { @class = "" })
                                @Html.ValidationMessageFor(model => model.Position)
                            </p>
                            <p>
                                <label>
                                    兴趣点：</label>
                                @foreach (var item in InterestList)
                                {

@*                                    @Html.CheckBox("Interest", InterestArry.Contains(item.Value), new { @class = "checkbox", Value = item.Value, @style = "magin-left:5px" });
*@                                    <input name="Interest" class="checkbox" id="Interest" style="magin-left: 5px;" type="checkbox" CHECKED="@InterestArry.Contains(item.Value)" value="@item.Value"/>
                                    @item.Text;

                                }
                                @Html.ValidationMessageFor(model => model.Interest)
                            </p>
                            <p style="width: 100%; height: 220px">
                                <label>
                                    简介：</label>
                                @Html.TextAreaFor(model => model.Introduction, new { @class = "TextArea", cols = "100", rows = "10" })
                                @Html.ValidationMessageFor(model => model.Introduction)
                            </p>
                        </div>
                        <div>
                            <input class="sub" type="submit" value="确定" style="width: 50px" /></div>
                    </div>
                </td>
            </tr>
        </table>
        </form>
    </div>
}
@section Side{
    @Html.Partial("Side")
}
<script>
    function getValidateCode() {
        $.ajax({
            type: "POST",
            url: "/vip/login",
            data: "User=" + User + "&Pwd=" + Pwd + "&code=" + code,
            success: function (data) {
                var json = eval("(" + data + ")");
                if (json.statusCode == 200) {
                    window.location = '@Url.Action("index", "vip")';
                }
                else {
                    alert(json.message);
                }
            }
        });

    }
    $(function () { $("#registerForm").validate(); });
</script>
